<template>
  <div>
		{{ title }}
    <br />
    pinia state: {{ testStore.msg }}
    <button @click="handleInvoke">调用rust函数</button>
  </div>
</template>

<script lang="ts" setup>
import { ref } from "vue";
import { invoke } from "@tauri-apps/api";
import useTestPinia from "@/store/useTestPinia";

const title = ref("Home");
const testStore = useTestPinia();

const handleInvoke = () => {
  invoke("invoke_fn", {
    // 方法名需要转换为驼峰命名法
    invokeParpms: {
      name: "hello",
      is_flog: true, // 参数保存和 rust 函数一致
    }
  });
}

</script>

<style lang="scss" scoped>
@import "@/styles/var.scss";
</style>
